home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / winchk / winchk.pas < prev    next >
Pascal/Delphi Source File  |  1995-12-22  |  2KB  |  82 lines

  1. {
  2.  Designer:  Craig Ward
  3.  Date:      1/9/95
  4.  
  5.  Function:  Check execution of WinExec command line
  6. *******************************************************************************}
  7. unit WinChk;
  8.  
  9. interface
  10.  
  11. uses
  12.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  13.   Forms, Dialogs;
  14.  
  15. type
  16.  TCheckWinExec = class(TComponent)
  17.   private
  18.     { Private declarations }
  19.   protected
  20.     { Protected declarations }
  21.   public
  22.     { Public declarations }
  23.     function custCheckWinExec(i: integer): string;
  24.   published
  25.     { Published declarations }
  26. end;
  27.  
  28. procedure Register;
  29.  
  30. {****************************************************************************}
  31. implementation
  32.  
  33. {procedure to register this as a custom component}
  34. procedure Register;
  35. begin
  36.   RegisterComponents('Samples', [TCheckWinExec]);
  37. end;
  38.  
  39. {read the returned value, and return text}
  40. function TCheckWinExec.custCheckWinExec(i: integer): string;
  41. var
  42.  s: string;
  43. begin
  44.  case i of
  45.   0:
  46.    result := 'System was out of memory, executable file was corrupt, or relocations were invalid.';
  47.   2:
  48.    result := 'File was not found.';
  49.   3:
  50.    result := 'Path was not found.';
  51.   5:
  52.    result :=    'Attempt was made to dynamically link to a task, or there was a sharing or network-protection error.';
  53.   6:
  54.    result := 'Library required separate data segments for each task.';
  55.   8:
  56.    result :=    'There was insufficient memory to start the application.';
  57.   10:
  58.    result := 'Windows version was incorrect.';
  59.   11:
  60.    result :=    'Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image.';
  61.   12:
  62.    result :=    'Application was designed for a different operating system.';
  63.   13:
  64.    result := 'Application was designed for MS-DOS 4.0.';
  65.   14:
  66.    result :=    'Type of executable file was unknown.';
  67.   15:
  68.    result := 'Attempt was made to load a real-mode application (developed for an earlier version of Windows).';
  69.   16:
  70.    result := 'Attempt to load second instance of an executable containing multiple data segments not marked read-only.';
  71.   19:
  72.    result :=    'Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded.';
  73.   20:
  74.    result := 'Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt.';
  75.   21:
  76.    result :=    'Application requires 32-bit extensions.';
  77.  end;
  78. end;
  79.  
  80.  
  81. end.
  82.